<?php namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;

abstract class Controller extends BaseController {
	
	protected function toJson($data){
		return json_encode($data, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
	}
    
    public function __destruct(){
        //记录操作日志
        if(property_exists($this, 'withOpLog') && $this->withOpLog){
            $this->opLog();
        }
        //同步缓存
        if(property_exists($this, 'withSyncCache') && $this->withSyncCache){
            $this->syncCache();
        }
    }
}
